package com.thiswhyme.demo.msgpush.core.impl.websocket.event;

import com.thiswhyme.demo.msgpush.core.event.AbstractCloseEventWsHandler;
import com.thiswhyme.demo.msgpush.core.event.bean.WebSocketEvent;
import com.thiswhyme.demo.msgpush.core.impl.websocket.SessionManager;
import lombok.extern.slf4j.Slf4j;

/**
 * @description: WebSocket连接关闭事件处理器-ws实现
 * @author: thiswhyme
 * @date: 2021/9/28
 */
@Slf4j
public class CloseEventWsHandler extends AbstractCloseEventWsHandler {

    @Override
    public void doHandle(WebSocketEvent event) {
        event.getIdentifiers().forEach(identifier -> {
            SessionManager.removeBySessionId(identifier, event.getMsgContent());
        });
    }
}
